//package com.entrogy.controller;
//
//import com.entrogy.bean.Appraisal;
//import com.entrogy.bean.Attendance;
//import com.entrogy.bean.PageBean;
//import com.entrogy.service.AppraisalService;
//import com.entrogy.utils.DateUtils;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * @Author 许红松
// * @date 2019/5/15 0015 下午 5:35
// */
//@RestController
//@Transactional
//@RequestMapping(value = "/appraisals")
//@Api(description = "对考勤管理信息操作的相关接口")
//public class AppraisalsController {
//
//    @Autowired
//    private AppraisalService appraisalService;//考勤service接口
//
//    @ApiOperation(value = "分页获取所有考勤的流水")
//    @ApiImplicitParams({
//            @ApiImplicitParam(value = "学校ID",name = "school_code",dataType = "int",paramType = "query",required = false),
//            @ApiImplicitParam(value = "姓名",name = "userName",dataType = "String",paramType = "query",required = false),
//            @ApiImplicitParam(name="page",value = "当前页数",required = true,dataType = "Integer",paramType = "query"),
//            @ApiImplicitParam(value = "每页条数",name = "total",dataType = "Integer",paramType = "query",required = true)
//    })
//    @RequestMapping(value = "/selectAppraisalByList",method = RequestMethod.POST)
//    public PageBean<Appraisal> selectAppraisalByList(Integer currentPage, Integer pageSize, String school_code, String userName, String beginDate, String endDate,String personId){
//        Map<String,Object> map=new HashMap<>();
//        setMap(currentPage,pageSize,school_code,userName,beginDate,endDate,personId,map);
//        List<Appraisal> list=appraisalService.selectAppraisalByList(map);
//        int total1=appraisalService.total(map);
//        return  new PageBean<Appraisal>().pageBeans(list,total1);
//    }
//
//
//    @ApiOperation(value = "分页获取所有考勤的信息")
//    @ApiImplicitParams({
//            @ApiImplicitParam(value = "学校ID",name = "school_code",dataType = "int",paramType = "query",required = false),
//            @ApiImplicitParam(value = "姓名",name = "userName",dataType = "String",paramType = "query",required = false),
//            @ApiImplicitParam(name="page",value = "当前页数",required = true,dataType = "Integer",paramType = "query"),
//            @ApiImplicitParam(value = "每页条数",name = "total",dataType = "Integer",paramType = "query",required = true)
//    })
//    @RequestMapping(value = "/getAttendanceByList",method = RequestMethod.POST)
//    public PageBean<Attendance> getAttendanceByList(Integer currentPage, Integer pageSize, String school_code, String userName, String beginDate, String endDate,String personId){
//        Map<String,Object> map=new HashMap<>();
//        setMap(currentPage,pageSize,school_code,userName,beginDate,endDate,personId,map);
//        List<Attendance> list=appraisalService.getAttendanceByList(map);
//        int total1=appraisalService.getTotal(map);
//        return  new PageBean<Attendance>().pageBeans(list,total1);
//    }
//
//    /**
//     * 调用
//     * @param page
//     * @param total
//     * @param school_code
//     * @param userName
//     * @param beginDate
//     * @param endDate
//     * @param personId
//     * @param map
//     * @return
//     */
//    private  Map<String,Object>  setMap(Integer page, Integer total, String school_code, String userName, String beginDate, String endDate,String personId,Map<String,Object> map){
//
//        if (beginDate!=null && !"".equals(beginDate)){
//            map.put("beginDate",beginDate);
//        }else{
//            map.put("beginDate", DateUtils.GetNowDate2());
//        }
//        if (endDate!=null && !"".equals(endDate)){
//            map.put("endDate",endDate);
//        }
//        if (school_code!=null && !"".equals(school_code)){
//            map.put("school_code",school_code);
//        }
//        if (userName!=null && !"".equals(userName)){
//            map.put("userName",userName);
//        }
//        if (personId!=null && !"".equals(personId)){
//            map.put("personId",personId);
//        }
//        if (page!=null && page!=0){
//            map.put("pages",(page-1)*total);
//        }
//        if (total!=null && total!=0){
//            map.put("total",total);
//        }
//        return  map;
//    }
//
//    @ApiOperation(value = "考勤当月统计")
//    @ApiImplicitParams({
//            @ApiImplicitParam(value = "学校ID",name = "school_code",dataType = "int",paramType = "query",required = false),
//            @ApiImplicitParam(value = "姓名",name = "userName",dataType = "String",paramType = "query",required = false)
//
//    })
//    @RequestMapping(value = "/getStatisticsList",method = RequestMethod.POST)
//    public List<Map<String,Object>> getStatisticsList(String school_code, String userName, String beginDate, String endDate,String personId){
//        Map<String,Object> map=new HashMap<>();
//        List<Map<String,Object>> list=appraisalService.getStatisticsList(map);
//        return  list;
//    }
//
//
//    @ApiOperation(value = "分页获取所有考勤的信息")
//    @ApiImplicitParams({
//            @ApiImplicitParam(value = "学校ID",name = "school_code",dataType = "int",paramType = "query",required = false),
//            @ApiImplicitParam(value = "姓名",name = "userName",dataType = "String",paramType = "query",required = false),
//            @ApiImplicitParam(name="page",value = "当前页数",required = true,dataType = "Integer",paramType = "query"),
//            @ApiImplicitParam(value = "每页条数",name = "total",dataType = "Integer",paramType = "query",required = true)
//    })
//    @RequestMapping(value = "/getAttendanceByList2",method = RequestMethod.POST)
//    public PageBean<Attendance> getAttendanceByList2(Integer currentPage, Integer pageSize, String school_code, String userName, String beginDate, String endDate,String personId){
//        Map<String,Object> map=new HashMap<>();
//        if (beginDate!=null && !"".equals(beginDate)){
//            map.put("beginDate",beginDate);
//        }
//        if (pageSize!=null && pageSize!=0){
//            map.put("total",pageSize);
//        }
//        if (currentPage!=null && currentPage!=0){
//            map.put("pages",(currentPage-1)*pageSize);
//        }
//        if (school_code!=null && !"".equals(school_code)){
//            map.put("school_code",school_code);
//        }
//        if (endDate!=null && !"".equals(endDate)){
//            map.put("endDate",endDate);
//        }
//        if (personId!=null && !"".equals(personId)){
//            map.put("personId",personId);
//        }
//
//        List<Attendance> list=appraisalService.getAttendanceByList(map);
//        int total1=appraisalService.getTotal(map);
//        return  new PageBean<Attendance>().pageBeans(list,total1);
//    }
//
//}
